import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/authenticate',
    method: 'post',
    data
  })
}

// 获取当前登录用户信息接口
export function getInfo() {
  return request({
    url: '/userInfo',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

// 获取用户信息
export function userList(query) {
  return request({
    url: '/user',
    method: 'get',
    params: query
  })
}

export function updateUser(id, data) {
  return request({
    url: `/user/${id}`,
    method: 'put',
    data
  })
}

export function getUserDetail(id) {
  return request({
    url: `/user/${id}`,
    method: 'get'
  })
}

